package cn.sju.tq.service.impl;

import cn.sju.tq.mapper.OrderMapper;
import cn.sju.tq.pojo.Order;
import cn.sju.tq.service.OrderService;

import java.time.LocalDateTime;
import java.util.List;

public class OrderServiceImpl implements OrderService {

    private OrderMapper orderMapper;

    public OrderMapper getOrderMapper() {
        return orderMapper;
    }

    public void setOrderMapper(OrderMapper orderMapper) {
        this.orderMapper = orderMapper;
    }

    @Override
    public void addOrder(Order order){
        System.out.println("对用户添加订单的操作进行权限检查---通过检查");
        //调用持久层对应的持久化方法
        order.setCreateTime(LocalDateTime.now());
        String line = "" + (System.currentTimeMillis() + (int) (Math.random() * 1000));
        order.setOrderNo(line.substring(line.length() - 8));
        orderMapper.insert(order);
        System.out.println("把当前的操作记录到系统日志");
    }
}
